﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.IO.IsolatedStorage;
using System.Diagnostics;
using TakePhotoTogether.Dao;

namespace TakePhotoTogether.Utils
{
    public class FtuFile
    {
        //                  0. Welcome
        //                      |
        //                   1.MyView
        //                      |
        //      |-------------------------------|
        //  2.Connected                      3.Gallery
        //      |  |                            |
        //      |   -----------------           |
        //      |                   |           |
        //  4.SplitView          5.Gallery   6.Connected
        //      |                   |           |
        //  7.Gallery           8.SplitView  9.SplitView
        //
        public enum State
        {
            Closed = 0,
            Welcome = 1,
            MyView = 2,
            MV_Connected = 3,
            MV_Gallery = 4,
            MV_C_SplitView = 5,
            MV_C_Gallery = 6,
            MV_G_Connected = 7,
            MV_C_SV_Gallery = 8,
            MV_C_G_SplitView = 9,
            MV_G_C_SplitView = 10
        }

        private const string FTU_State_Key = "FTU_STATE";

        public static void setState(State value) {
            IsolatedStorageDao.Save(value, FTU_State_Key);
        }

        public static State getState(String key)
        {
            State currentState = IsolatedStorageDao.Load<State>(FTU_State_Key);

            if (currentState == null) {
                setState(State.Closed);
                return State.Closed;
            }

            return currentState;
        }
    }
}
